package cn.cumt.lkk.dao.hibernate;

import cn.cumt.lkk.dao.PersonDao;
import cn.cumt.lkk.model.Person;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Created by lkk on 2015/4/17.
 */
@Repository("personDao")
public class PersonDaoHibernate extends GenericDaoHibernate<Person,Long> implements PersonDao   {

    public PersonDaoHibernate() {
        super(Person.class);
    }

    @Override
    public List<Person> findByLashName(String lastName) {
        return getSession().createCriteria(Person.class).add(Restrictions.eq("lastName", lastName)).list();
    }
}
